package main

func main() {
	println("hello word")
	chans := make(chan int, 3);

	//done1 := make(chan bool);
	//
	//done2 := make(chan bool);

	//go f1(chans, done1)
	//go f2(chans, done2)
	//
	//<-done1
	//<-done2

	go f1(chans)
	go f2(chans)

	for i := 1; i <= cap(chans); i++ {
		select {
		case chansDone := <-chans:
			println(chansDone)
		default:
			println("is done")
		}
	}

}

//func f1(chans chan int, done chan bool) {
//	chans <- 5
//	println("is f1")
//	done <- true
//}
//
//func f2(chans chan int, done chan bool) {
//	chans <- 6
//	println("is f2")
//	done <- true
//}

func f1(chans chan int) {
	chans <- 5
	println("is f1")

}

func f2(chans chan int) {
	chans <- 6
	println("is f2")

}